<!doctype html>
<html lang="{idioma_js}">
    <head>
        <title>CMS 2.0+ | {titulo} | Link Nacional</title>
        {include_header_view}
        <script>
            $(window).load(function(){
                $(".datatable td button").click(function(a){
                    a.preventDefault();
                    var obj = this;
                    var id = $(this).attr('id');
                    var status = $(this).attr('value');
                    //var value = $(this).attr('value');
                    $.ajax({
                        //url: base_cms+"contato/status",
                        url: "{link_produto_status}",
                        type: "POST",
                        data: {
                            'id' : id,
                            'status' : status
                        },
                        dataType: "json",
                        beforeSend: function(){
                            $(obj).addClass('load');
                        },
                        success: function(data) {
                            if(data.cod == 999){
                                //$.wl_Alert(data.msg,'success','#content');
                                $.msg(data.msg,{header:data.header,live:10000});
                                $('#from_list_prod #id').val(data.id);
                                $(obj).attr('class',data.prod_status);
                                $(obj).attr('value',data.prod_status_id);
                            } else {
                                //$.wl_Alert(data.msg,'warning','#content');
                                $.msg(data.msg,{header:data.header,live:10000});
                                $('#from_list_prod').color_campos_form({
                                    campos:data.campos
                                });
                            }
                        }
                    });
                });
            });
        </script>
    </head>
    <body>

        {include_body_header_view}
        {include_body_menu_left_view}

        <section id="content">

            <div class="g12">

                <h1>{titulo}
                    <span><a href="{base_cms}{link_cadastrar_produto}" title="Cadastrar Novo Produto" class="small">{descricao_titulo}</a></span>
                </h1>
                

                <div id="from_list_prod" class="dataTables_wrapper">
                    <table class="datatable">
                        <thead>
                            <tr>
                                <th>{lang_title_status}</th>
                                <th>{lang_title_titulo}</th>
                                <th>{lang_title_preco_custo}</th>
                                <th>{lang_title_codigo_referencia}</th>
                                <th>{lang_title_destacar}</th>
                                <th>{lang_title_acao}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {produtos}
                            <tr>
                                <td><button class="{prod_status} icon small" id="{prod_id}" value="{prod_status_id}"></button>
                                <td>{prod_titulo}</td>
                                <td>{prod_preco_custo}</td>
                                <td>{prod_codigo_referencia}</td>
                                <td>{prod_destacar}</td>
                                <td>{acao}</td>
                            </tr>
                            {/produtos}
                        </tbody>
                    </table>
                </div>

            </div>
        </section>
        <footer>
            {include_footer_view}
        </footer>
    </body>
</html>